﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Ebada.Platform.Model;
using Ebada.UI.Base;
using Ebada.Client;
using Ebada.Core;
using Ebada.Client.Platform;
namespace Ebada.Modules.Document
{
    /// <summary>
    /// 单证类型编辑
    /// </summary>
    public partial class frmDocumentTypeFind : FormBase, IPopupFormEdit {
        SortableSearchableBindingList<Activities> m_Act = new SortableSearchableBindingList<Activities>();

        public frmDocumentTypeFind() {
            InitializeComponent();
        }
        void dataBind() {
        }
        #region IPopupFormEdit Members
        private string strname = "";

        public string StrName
        {
            get { return txtCnName.Text; }
            set { strname = value; }
        }

        private DocumentType rowData = null;

        public object RowData
        {
            get
            {
                return rowData;
            }
            set
            {
                if (value == null) return;
                if (rowData == null)
                {
                    this.rowData = value as DocumentType;
                    dataBind();
                    InitComboBoxData();
                }
                else
                {
                    ConvertHelper.CopyTo<DocumentType>(value as DocumentType, rowData);
                }
            }
        }

     

        #endregion

        private void InitComboBoxData() {
 
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="comboBox"></param>
        /// <param name="displayMember"></param>
        /// <param name="valueMember"></param>
        /// <param name="nullTest"></param>
        /// <param name="cnStr"></param>
        /// <param name="post"></param>
        public void SetComboBoxData(DevExpress.XtraEditors.LookUpEdit comboBox, string displayMember, string valueMember, string nullTest, string cnStr, SortableSearchableBindingList<Activities> post)
        {
            comboBox.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            comboBox.Properties.DataSource = post;
            comboBox.Properties.DisplayMember = displayMember;
            comboBox.Properties.ValueMember = valueMember;
            comboBox.Properties.NullText = nullTest;
        }

        private void txtEnName_EditValueChanged(object sender, EventArgs e)
        {

        }

        private void buttonEdit1_Properties_Click(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtCnName.Text == "")
            {
                MessageBox.Show("种类名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtCnName.Focus();
                return;
            }
 
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}